/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Commons.Replicazione;

import Commons.Activity;
import Commons.Workflow;
import java.util.ArrayList;
import java.util.HashMap;
;
import Manager.Manager;
import Manager.WFQueueManager;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.stream.XMLStreamException;

/**
 *
 * @author carlo
 */
public class StatoManager {

    //manager
    private String idManager;
    private HashMap<Integer,Integer> VectorClockManager ;
    private int PosizionedelVcManager;
    //WFQueueManager
    private String idWFQ;
    private ArrayList<Workflow> wfQueue;
    private HashMap<Integer,Integer> VectorClockWFQM;
    private int PosizionedelVcWFQM;
    private int NumeroTotaleElementiInseritiWFQM;

    public StatoManager(String idManager, HashMap<Integer, Integer> VectorClockManager, String idWFQ, ArrayList<Workflow> wfQueue, HashMap<Integer, Integer> VectorClockWFQM, int NumeroTotaleElementiInseritiWFQM) {
        this.idManager = idManager;
        this.VectorClockManager = VectorClockManager;
        this.idWFQ = idWFQ;
        this.wfQueue = wfQueue;
        this.VectorClockWFQM = VectorClockWFQM;
        this.NumeroTotaleElementiInseritiWFQM = NumeroTotaleElementiInseritiWFQM;
    }

    public void setNumeroTotaleElementiInseritiWFQM(int NumeroTotaleElementiInseritiWFQM) {
        this.NumeroTotaleElementiInseritiWFQM = NumeroTotaleElementiInseritiWFQM;
    }

    public void setVectorClockManager(HashMap<Integer, Integer> VectorClockManager) {
        this.VectorClockManager = VectorClockManager;
    }

    public void setVectorClockWFQM(HashMap<Integer, Integer> VectorClockWFQM) {
        this.VectorClockWFQM = VectorClockWFQM;
    }

    public void setPosizionedelVcManager(int PosizionedelVcManager) {
        this.PosizionedelVcManager = PosizionedelVcManager;
    }

    public void setPosizionedelVcWFQM(int PosizionedelVcWFQM) {
        this.PosizionedelVcWFQM = PosizionedelVcWFQM;
    }

    public void setIdManager(String idManager) {
        this.idManager = idManager;
    }

    public void setIdWFQ(String idWFQ) {
        this.idWFQ = idWFQ;
    }

    public void setWfQueue(ArrayList<Workflow> wfQueue) {
        this.wfQueue = wfQueue;
    }
    public int getPosizioneVectorClockManager(){
       return this.PosizionedelVcManager;
    }
    public int getPosizioneVectorClockWFQM(){
        return this.PosizionedelVcWFQM;
    }








    public int getNumeroTotaleElementiInseritiWFQM() {
        return NumeroTotaleElementiInseritiWFQM;
    }

    public HashMap<Integer, Integer> getVectorClockManager() {
        return VectorClockManager;
    }

    public HashMap<Integer, Integer> getVectorClockWFQM() {
        return VectorClockWFQM;
    }

    public String getIdManager() {
        return idManager;
    }

    public String getIdWFQ() {
        return idWFQ;
    }

    public ArrayList<Workflow> getWfQueue() {
        return wfQueue;
    }



    public StatoManager(){
        VectorClockWFQM=new HashMap<Integer,Integer>();
        wfQueue=new ArrayList<Workflow>();
        VectorClockManager = new HashMap<Integer,Integer>();

    }
    public void aggiornaStato(Manager m) throws XMLStreamException{
         this.idManager=m.getID();
         this.VectorClockManager=m.getLogger().getVectorClock();
         this.PosizionedelVcManager=m.getLogger().getPosizioneNelVC();
         this.idWFQ=m.getWFQueueManager().getID();
         this.wfQueue=m.getWFQueueManager().getWfQueue();
         this.VectorClockWFQM=m.getWFQueueManager().getVCLogger();
         this.PosizionedelVcWFQM=m.getWFQueueManager().getL().getPosizioneNelVC();
         this.NumeroTotaleElementiInseritiWFQM=m.getWFQueueManager().getNumeroElementiInseriti();

    }




}
